import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { LxSupplierVO, LxSupplierForm, LxSupplierQuery } from '@/api/lingxing/lxSupplier/types';

/**
 * 查询领星供应商列表
 * @param query
 * @returns {*}
 */

export const listLxSupplier = (query?: LxSupplierQuery): AxiosPromise<LxSupplierVO[]> => {
  return request({
    url: '/lingxing/lxSupplier/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询领星供应商详细
 * @param id
 */
export const getLxSupplier = (id: string | number): AxiosPromise<LxSupplierVO> => {
  return request({
    url: '/lingxing/lxSupplier/' + id,
    method: 'get'
  });
};

/**
 * 新增领星供应商
 * @param data
 */
export const addLxSupplier = (data: LxSupplierForm) => {
  return request({
    url: '/lingxing/lxSupplier',
    method: 'post',
    data: data
  });
};

/**
 * 修改领星供应商
 * @param data
 */
export const updateLxSupplier = (data: LxSupplierForm) => {
  return request({
    url: '/lingxing/lxSupplier',
    method: 'put',
    data: data
  });
};

/**
 * 删除领星供应商
 * @param id
 */
export const delLxSupplier = (id: string | number | Array<string | number>) => {
  return request({
    url: '/lingxing/lxSupplier/' + id,
    method: 'delete'
  });
};
